package org.jeecg.enums;

/**
 * 开票类型:
 *  1:不开票据  2:纸质票据  3:电子发票
 */
public enum InvoiceTypeEnum {
    INVOICE_TYPE_NO("1", "不开票据"),
    INVOICE_TYPE_PAPER("2", "纸质票据"),
    INVOICE_TYPE_ELE("3", "电子发票"),
    ;

    private String code;
    private String desc;

    InvoiceTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        InvoiceTypeEnum[] enums = values();
        for (InvoiceTypeEnum typeEnum : enums) {
            if (typeEnum.getCode().equals(value.intValue())) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static String getValue(String desc) {
        InvoiceTypeEnum[] enums = values();
        for (InvoiceTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
